import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: "/home"
  },
  {
    path: "/home",
    component: Home,
    children: [
      {
        path: '',
        redirect: "news"
      },
      {
        path: "news",
        component: () => import('../views/News.vue')
      },
      {
        path: "message",
        component: () => import('../views/Message.vue')
      }
    ]
  },
  {
    path: '/about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: "/user/:id",
    component: () => import('../views/User.vue')
  },
  {
    path: "/profile",
    component: () => import('../views/Profile.vue')
  },
]

const router = new VueRouter({
  routes,
  mode: "hash",
  linkActiveClass: "active"
})

export default router
